﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace TeamFoundation.ContinuousMerge
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            List<string> args = new List<string>(Environment.GetCommandLineArgs());
            args.RemoveAt(0);
            if (args.Contains("/console"))
            {
                args.Remove("/console");

                MainService svc = new MainService();

                Console.WriteLine("Starting...");
                svc.Start(args.ToArray());
                Console.WriteLine("Press any key to terminate.");
                Console.ReadKey(true);
                Console.WriteLine("Terminating...");
                svc.Stop();
            }
            else
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[] 
		        { 
			        new MainService() 
		        };

                ServiceBase.Run(ServicesToRun);
            }
        }
    }
}
